UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5R/PGZNpkOVOWo4uve95j+l805d83dsozevO9X24Ctc=' 
WHERE 
  key_id = '7d2012992506c18e7920165d937b1843f1938422b7180be72ac468a5e76883dd' 
  AND (
    token = '5R/PGZNpkOVOWo4uve95j+l805d83dsozevO9X24Ctc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029