UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ifMTSyyr+lBlQCW62vM9C8JgTPUT2ReChmNdGxt5wg4=' 
WHERE 
  key_id = '8c09456662959816825d60a896fbc1fa94ae282b90858cfa1f045b5221a9133a' 
  AND (
    token = 'ifMTSyyr+lBlQCW62vM9C8JgTPUT2ReChmNdGxt5wg4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037