UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5npD5q4u5DJ1/s4rKSzZiTYLVQUDpr3lGtPCOzYvIMo='
WHERE
key_id = 'aadd317dce9a7d37a12b7fa453d3c71b539f0bee3bdd2cf1ec09d64eb940f19f'
AND (
token = '5npD5q4u5DJ1/s4rKSzZiTYLVQUDpr3lGtPCOzYvIMo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)