UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JFJzhz/zKjU5r+0pVRSmjAY0EASTRowf8BvNp+SEZXE='
WHERE
key_id = 'f47a0729b7d188ff0f08be553f91fd605a0454b0349f4b1e96c890680f44ff02'
AND (
token = 'JFJzhz/zKjU5r+0pVRSmjAY0EASTRowf8BvNp+SEZXE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)