UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'w3LQgsYvyJrnVtg4Oxtt131x3DThyIhejMUsI8xqeNo='
WHERE
key_id = '9863b8aef3c6fdaa8996edf8de703370c50f800cc644922620b680c0e6e2610b'
AND (
token = 'w3LQgsYvyJrnVtg4Oxtt131x3DThyIhejMUsI8xqeNo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)