UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ueAEE1YJNZB4/RWZVXBeYAQ3d4q7G9+2FqWI48D4eTM='
WHERE
key_id = '85779c9e746e906472ea8337e8a668728c0a8452d094ce2f6237718fb7d1947d'
AND (
token = 'ueAEE1YJNZB4/RWZVXBeYAQ3d4q7G9+2FqWI48D4eTM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)