UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'itqblkOiWeeE1Tk/Ht4J07jQx3BsG2+MPZUwGKMy2uo=' 
WHERE 
  key_id = '2d100b1aac08c3df0a448dd89c65d9ea141e8764eac228e00a4bd63d7ab2d4a7' 
  AND (
    token = 'itqblkOiWeeE1Tk/Ht4J07jQx3BsG2+MPZUwGKMy2uo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035