UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ScuhgyXwEvpNB6roVtKXLMKDd1m2qPmwuSmQ5TxqMUM='
WHERE
key_id = '4d493410701e744b7b812eb18a35fa3fff7b3766164df85a308643fb8caaabcc'
AND (
token = 'ScuhgyXwEvpNB6roVtKXLMKDd1m2qPmwuSmQ5TxqMUM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)