UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SNnQYg2WArD5JQKwKoCxCCfYWWwx5kTAwuE3lu7XWa4='
WHERE
key_id = 'b136455cf4a5fc6b666530a3cb18b750b0d7eceddcf95890552a1fa52983e8d7'
AND (
token = 'SNnQYg2WArD5JQKwKoCxCCfYWWwx5kTAwuE3lu7XWa4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)