UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'siEA0liYWYgqutHGo0qgTY7k/CAwmIGmzrOdT20DZgU='
WHERE
key_id = 'c7983999794ecff185cd464b9d625e8d609f20c4f8066f75117c03c5b9529c7f'
AND (
token = 'siEA0liYWYgqutHGo0qgTY7k/CAwmIGmzrOdT20DZgU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)