UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'saNslUbSFlO1xjZGNedwduLwZdFw7k6V6bUVRvU4OBI=' 
WHERE 
  key_id = 'f4406fcab7c2cc4375466a9dcff3d257329b599b29bf8b582c697a82f370e472' 
  AND (
    token = 'saNslUbSFlO1xjZGNedwduLwZdFw7k6V6bUVRvU4OBI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00121