UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MCeBRLu52eeyk9/e7hcwvTgESTBYiGic14c0fgMsCUs=' 
WHERE 
  key_id = '786de7d4c0193a9467599724d590dae1d8a58c1b3dbcd41b7aca2c8215c8c811' 
  AND (
    token = 'MCeBRLu52eeyk9/e7hcwvTgESTBYiGic14c0fgMsCUs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023