UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QFzFu8oMKT2my7WhuXFSEPsI2EdLE/pC+4tkAtxjw1k=' 
WHERE 
  key_id = '64eb661bb08b56106731305adf8f89a774919cbe13620c1fb37d35f62c069a5a' 
  AND (
    token = 'QFzFu8oMKT2my7WhuXFSEPsI2EdLE/pC+4tkAtxjw1k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040