UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cNqn2KWAg326tBgcN2xq+wfTiL7S3UH/lJ3otugmTPY=' 
WHERE 
  key_id = 'e3d6a61f16c84a57e1535792c0e4756ff92c275c6d360b418792fa3c8e7286a0' 
  AND (
    token = 'cNqn2KWAg326tBgcN2xq+wfTiL7S3UH/lJ3otugmTPY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040