UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8wTcIZnXXLiOVFuAwneLSceFeV9CbwNBCJnKwrZzitI='
WHERE
key_id = 'a8360a0adbd04e5a8879860633ea2775c45e30c15892789d2b10893419a56d1c'
AND (
token = '8wTcIZnXXLiOVFuAwneLSceFeV9CbwNBCJnKwrZzitI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)