UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tew9/NPLlOUzuY2H2icBPWL9a/SWJxbIJEx/8FEPflQ=' 
WHERE 
  key_id = '838d2caa19671c7734fbdd8c361436f65ab7e3fee9f6c7403a17143f70d86717' 
  AND (
    token = 'tew9/NPLlOUzuY2H2icBPWL9a/SWJxbIJEx/8FEPflQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032