UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PeSA78yZsM7fQuzu5VihLq62RtxLnmNAEHY1dVN8SeE='
WHERE
key_id = 'b8c4c2dd96b2846d693ab1a06733434a5b09439fd9d417293a7e1172ae3c2e38'
AND (
token = 'PeSA78yZsM7fQuzu5VihLq62RtxLnmNAEHY1dVN8SeE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)