UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '86XCYfuqZJu6YO88qApvraLMTZ4gnc19n17LaMD+SVY=' 
WHERE 
  key_id = 'e0f90da25d8eda77b691ee9f049c0251de043d92c54625f20fe2ffad08b742b4' 
  AND (
    token = '86XCYfuqZJu6YO88qApvraLMTZ4gnc19n17LaMD+SVY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048