UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LMbcRRfHlDakDnOANWrWNQa26Ix/hh1Sl2FLI9l3ft0=' 
WHERE 
  key_id = 'd6821746b9bee870f84222033ce93c98aa3c75bbeeb10f15d726306acd5fbfd3' 
  AND (
    token = 'LMbcRRfHlDakDnOANWrWNQa26Ix/hh1Sl2FLI9l3ft0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026