UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'agtpZgJrb1UhhQhOdDVXVqNpZyaMhnYMy2qZkLF9Xms='
WHERE
key_id = '8720935fe02cc7af8e0e612c976f235e1ac364b6ef176f725bc814e0e6ef96e2'
AND (
token = 'agtpZgJrb1UhhQhOdDVXVqNpZyaMhnYMy2qZkLF9Xms='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)