UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BmFJkc7TZJY17n/5kLZq+f9hdiSMF6Us9OjWZgukc3c='
WHERE
key_id = 'eb97aa19ac29644c47810a8aef3e35391023937c21e0abc1fd8aea5724244de3'
AND (
token = 'BmFJkc7TZJY17n/5kLZq+f9hdiSMF6Us9OjWZgukc3c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)