UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ive0jbh9UNzsiQpyzeikIM+/Kfk/0/eSpECpV7gAmYs=' 
WHERE 
  key_id = 'f10bc3945092fa2360ec1c6c224bdfeeb2ac8307e484d6814263978bd320b295' 
  AND (
    token = 'Ive0jbh9UNzsiQpyzeikIM+/Kfk/0/eSpECpV7gAmYs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026