UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JTr/XaMc7Q9bwoWbCsh9w4UKSTOg/0Tyfk4PiGGW7lU=' 
WHERE 
  key_id = 'def94c88edc578640a8ff875d1b0a775275bf18ab83f387da56dcf715502a9ee' 
  AND (
    token = 'JTr/XaMc7Q9bwoWbCsh9w4UKSTOg/0Tyfk4PiGGW7lU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037