UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sWLaMCPsJfw7aupPhs6jhF9nKocjeWsFVC0agtcqP+U='
WHERE
key_id = 'c3b21738d7f73142788f92f8d6c0521af67afa71d63ec321dbfe766ca8bc51da'
AND (
token = 'sWLaMCPsJfw7aupPhs6jhF9nKocjeWsFVC0agtcqP+U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)