UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qwCnhyYqlylWPI4uO0GZGyMOop/gn7/PghOVp8/p9sA='
WHERE
key_id = '9b8b08dbe816ab53b6bf3cb6ad55620b1f5bf8927abf8280886190dd11ef6b50'
AND (
token = 'qwCnhyYqlylWPI4uO0GZGyMOop/gn7/PghOVp8/p9sA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)