UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P8mebqfGSkGyySmPjcTo7oa/HTkiUHnwWpokje6o4n0='
WHERE
key_id = 'a7ace2b37d5c6edfaf726eabef3c5fc61d8c5000f18a23a9686602a488ab5d12'
AND (
token = 'P8mebqfGSkGyySmPjcTo7oa/HTkiUHnwWpokje6o4n0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)